# Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
# Maintainer: kpcyrd <git@rxv.cc>

pkgname=cross
pkgver=0.2.5
pkgrel=1
pkgdesc="'Zero setup' cross compilation and 'cross testing' of Rust crates"
url="https://github.com/rust-embedded/cross"
arch=('loong64' 'x86_64')
license=('Apache' 'MIT')
depends=('gcc-libs')
makedepends=('rust')
optdepends=('docker: provide container'
            'podman: provide container')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/cross-rs/cross/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('8dfcad7aa8eb0b9ce18423c386fc03bc709e8c9ad2d7bcb1a77f9d1d1cd6fd2e')
b2sums=('1e2d5d27bfc13aed3132cbcc054e466ff10ca782a72d7c9cacea35a08e3afa88c3cf8d09a55b29a59fa2d11601e62baefdbdac5c1bfe0fecdf0ee6cfb92d4820')

build() {
  cd ${pkgname}-${pkgver}
  cargo build --release --locked
}

check() {
  cd ${pkgname}-${pkgver}
  cargo test --release --locked
}

package() {
  depends+=('rustup')
  cd ${pkgname}-${pkgver}
  install -Dm755 "target/release/cross" -t "${pkgdir}/usr/bin"
  install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
    LICENSE-APACHE LICENSE-MIT
}

# vim: ts=2 sw=2 et:
